import React, {PropTypes} from 'react'
import {StyleSheet, Text, View} from "react-native"
import Button from 'react-native-button'
import { Actions } from 'react-native-router-flux'

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
    borderWidth: 2,
    borderColor: 'red',
  },
})

// 使用drawer: React.PropTypes.object绑定才可以在content对应的组件中引用drawer
const contextTypes = {
  drawer: React.PropTypes.object,
}

const TabView = (props, context) => {
  const drawer = context.drawer
  return (
    <View style={[styles.container, props.sceneStyle ]}>
      <Button onPress={() => { Actions.refresh({key:'drawer', open:false}) }}>Back</Button>
      <Button onPress={() => { drawer.close(); Actions.images()}}>图片</Button>
      <Button onPress={() => { drawer.close(); Actions.texts()}}>段子</Button>
      <Button onPress={() => { drawer.close(); Actions.videos()}}>视频</Button>
    </View>
  )
}

TabView.contextTypes = contextTypes
// TabView.propTypes = propTypes

export default TabView;
